<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Amaze UI Admin table Examples</title>
  <meta name="description" content="这是一个 table 页面">
  <meta name="keywords" content="table">
  <% include("/common/inc/_css.html"){} %>
   <link rel="stylesheet" href="${ctxPath}/layui/css/layui.css" media="all" />
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->
<% include("/common/inc/_header.html"){} %>
<div class="am-cf admin-main">
  <!-- sidebar start -->
 <% include("/common/inc/_menu.html"){} %>
  <!-- sidebar end -->

  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">线索</strong> / <small>Clue</small></div>&nbsp;&nbsp;
         <a href="${ctxPath}/cluePool/list"><button type="button" class="am-btn am-btn-default"><span class="am-icon-archive"></span> 线索池</button>   </a>  &nbsp;&nbsp;  
          <a href="${ctxPath}/clue/ECharts/clueECharts"><button type="button" class="am-btn am-btn-default"><span class="am-icon-archive"></span> 统计</button>   </a>          
      </div>

      <hr>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
              <a href="${ctxPath}/clue/" class="am-btn am-btn-default"><span class="am-icon-plus"></span>新增</a>
              <button type="button" class="am-btn am-btn-default" onclick="deleteCustomer()"><span class="am-icon-trash-o"></span> 删除</button>
              <a href="${ctxPath}/poi/import" class="am-btn am-btn-default"><span class="am-icon-plus"></span>导入</a>
			  <a href="${ctxPath}/poi/export" class="am-btn am-btn-default"><span class="am-icon-plus"></span>导出</a> 
			 
			  </div>
          </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
          <div class="am-form-group">
            <select data-am-selected="{btnSize: 'sm'}" id="CriteriaType">
              <option ${CriteriaType=='-1'?'selected':''} value="-1">所有类别</option>
              <option ${CriteriaType=='COMPANY_NAME'?'selected':''} value="COMPANY_NAME">公司名</option>
              <option ${CriteriaType=='CONTACT_NAME'?'selected':''} value="CONTACT_NAME">联系人姓名</option>
              <option ${CriteriaType=='chargeName'?'selected':''} value="chargeName">负责人</option>
              <option ${CriteriaType=='createName'?'selected':''} value="createName">创建人</option>
            </select>
          </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
          <div class="am-input-group am-input-group-sm">
            <input type="text" class="am-form-field" id="content" value="${content!}">
          <span class="am-input-group-btn">
            <button class="am-btn am-btn-default" type="button" onclick="seek()">搜索</button>
          </span>
          </div>
        </div>
      </div>

      <div class="am-g">
        <div class="am-u-sm-12">
          <form class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main">
              <thead>
              <tr>
                <th class="table-check"><input type="checkbox" /></th><th class="table-id">序号</th><th class="table-title">公司名</th><th class="table-type">联系人姓名</th>
                <th class="table-author am-hide-sm-only">尊称</th><th class="table-author am-hide-sm-only">手机</th><th class="table-author am-hide-sm-only">下次联系时间</th><th class="table-author am-hide-sm-only">下次联系内容</th>
                <th class="table-author am-hide-sm-only">负责人</th><th class="table-author am-hide-sm-only">创建人</th><th class="table-author am-hide-sm-only">创建时间</th>
                 <th class="table-set">操作</th>
              </tr>
              </thead>
              <tbody>
              <%
              for(var item in list.list!){%>
               <tr>
                <td><input type="checkbox" value="${item.id}" name="clueId" class="box" /></td>
                <td>${itemLP.index}</td>
                <td>${item.COMPANY_NAME}</td>
                <td>${item.CONTACT_NAME}</td>
                <td>${item.SEX==1?'先生':'女士'}</td>
                <td>${item.PHONE}</td>
                <td>${item.NEXT_CONTACT_TIME,'yyyy-MM-dd'}</td>
                <td>${item.NEXT_CONTACT_INFO}</td>
                <td><a href="#">${item.chargeName}</a></td>
                 <td>${item.createName}</td>
                <td>${item.CREATE_TIME,'yyyy-MM-dd'}</td>
                <td>
                  <div class="am-btn-toolbar">
                    <div class="am-btn-group am-btn-group-xs">
                      <a href="${ctxPath}/clue/getInfo?id=${item.id}" class="am-btn am-btn-default am-btn-xs am-text-secondary am-hide-sm-only"><span class="am-icon-copy"></span>查看</a>
                      <a href="${ctxPath}/clue/${item.id}" class="am-btn am-btn-default am-btn-xs am-text-secondary am-hide-sm-only"><span class="am-icon-copy"></span>编辑</a>
                      
						<a onclick="deleteArticle('${item.id}')" 
						class="am-btn am-btn-default am-btn-xs am-text-dangeram-hide-sm-only"><span class="am-icon-trash-o"></span> 删除</a>
						<a href="http://192.168.14.108:8080/crm/clue/client/clue_client/${item.id}" class="am-btn am-btn-default am-btn-xs am-text-secondary am-hide-sm-only"><span class="am-icon-copy"></span>转换</a>
                    </div>
                  </div>
                </td>
              </tr>
             <%}%>
       </tbody>
            </table>
            <% 
             var curUrl = ctxPath + "/clue/list";
             include("/common/inc/_page.html",{pageUrl:curUrl}){}              
             %>
            <hr />
            <p>注：.....</p>
          </form>
        </div>

      </div>
    </div>

    <footer class="admin-content-footer">
      <hr>
      <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </footer>

  </div>
  <!-- content end -->
</div>

<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
<!-- 删除提示 -->
		<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
			<div class="am-modal-dialog">
				<div class="am-modal-hd">删除提示</div>
				<div class="am-modal-bd">你，确定要删除这条记录吗？</div>
				<div class="am-modal-footer">
					<span class="am-modal-btn" data-am-modal-cancel>取消</span> <span
						class="am-modal-btn" data-am-modal-confirm>确定</span>
				</div>
			</div>
		</div>

<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
<!-- 删除提示 -->
		<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm-box">
			<div class="am-modal-dialog">
				<div class="am-modal-hd">删除提示</div>
				<div class="am-modal-bd" id="msg"></div>
				<div class="am-modal-footer">
					<span class="am-modal-btn" data-am-modal-cancel>取消</span> <span
						class="am-modal-btn" data-am-modal-confirm>确定</span>
				</div>
			</div>
		</div>


<% include("/common/inc/_js.html"){} %>
<script type="text/javascript">
function deleteCustomer() {
	var ids = $("input[name='clueId']:checked");//获取复选框的值
	var idsArr = new Array();//创建数组
	var idsStr = "";
	var msg = 0;
	$.each(ids, function(index, item) {
		idsArr.push(item.value);//给数组添加值
		idsStr += item.value + ",";//把数组转化为字符串
		msg++;
	})
	$("#msg").html("你，确定要删除这"+msg+"条记录吗？");
	
	console.log(idsStr);//页面控制台打印字符串
	$('#my-confirm-box').modal({
		relatedTarget : this,
		onConfirm : function(options) {
			$.ajax({
				url : '${ctxPath }/cluePool/delete',
				data : idsStr,//把前台数据传到后台
				type : 'DELETE',
				success : function() {
					window.location.reload(); //刷新页面

				}
			})
		},
	});
}

</script>
<script type="text/javascript">
			function deleteArticle(id) {
				$('#my-confirm').modal({
					relatedTarget : this,
					onConfirm : function(options) {
						$.ajax({
							url : '${ctxPath }/clue/'+id,
							type:'DELETE',
							success : function() {
								window.location.reload(); //刷新页面
							}
						})
					},
					onCancel : function() {

					}
				});
			}
			
			function seek(){
				var CriteriaType=$("#CriteriaType").val();
				var content=$("#content").val();
				
				window.location.href="${ctxPath}/clue/list?CriteriaType="+CriteriaType+"&content="+content;
				
			}
		</script>
</body>
</html>
